﻿@page "/Profiles"
@using JinShun.OA.UI.Components
@using JinShun.OA.UI.Auth
@inherits AuthComponentBase
@attribute [TabItemOption(Text = "个人中心", Icon = "fa-solid fa-suitcase")]

<div class="tab-scroll-body">
    <AdminCard HeaderText="基本资料">
    <AdminAlert Text="仅能修改显示的名称登陆用户名无法修改"/>
    <ValidateForm OnValidSubmit="OnSaveDisplayName" Model="CurrentUser">
            <div class="row g-3 form-inline">
                <div class="col-12 col-sm-6">
                    <Display @bind-Value="@CurrentUser.UserName" />
                </div>
                <div class="col-12 col-sm-6">
                    <BootstrapInput @bind-Value="@CurrentUser.CreationTime" />
                </div>
                <div class="col-12 col-sm-6">
                    <BootstrapInput @bind-Value="@CurrentUser.Name"/>
                </div>
                <div class="col-12 col-sm-6">
                    <BootstrapInput @bind-Value="@CurrentUser.Phone"/>
                </div>
                <div class="col-12 col-sm-6">
                    <BootstrapInput @bind-Value="@CurrentUser.Email" />
                </div>
                <div class="col-12 col-sm-6">
                    <BootstrapInput @bind-Value="@CurrentUser.Address" />
                </div>
                <div class="col-12 justify-content-end">
                    <Button ButtonType="ButtonType.Submit" Icon="fa-solid fa-floppy-disk" Text="保存" />
                </div>
            </div>
        </ValidateForm>
    </AdminCard>
        <div style="height:5px;background-color:burlywood"></div>
    <AdminCard HeaderText="修改密码">
          <AdminAlert Text="密码不能低于8位"/>
        <ValidateForm OnValidSubmit="OnSavePassword" Model="updatePasswordDto">
              <div class="row g-3 form-inline">
                  <div class="col-12 col-sm-6">
                    <BootstrapInput @bind-Value="@updatePasswordDto.oldPassword" DisplayText="原密码" Readonly="IsDemo" />
                  </div>
                  <div class="col-12 col-sm-6 d-none d-sm-block">
                  </div>
                  <div class="col-12 col-sm-6">
                    <BootstrapPassword @bind-Value="@updatePasswordDto.newPassword" DisplayText="新密码" Readonly="IsDemo" />
                  </div>
                  <Block Condition="!IsDemo">
                      <div class="col-12 justify-content-end">
                          <Button ButtonType="ButtonType.Submit" Icon="fa-solid fa-floppy-disk" Text="保存" />
                      </div>
                  </Block>
              </div>
          </ValidateForm>
    </AdminCard>
</div>
